package com.gmail.avereshchaga.db.service;

import com.gmail.avereshchaga.db.dao.IUserDAO;
import com.gmail.avereshchaga.db.entity.IUser;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author <a href="mailto:avereshchaga@gmail.com">Vereshchaga Alexey</a>
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserDAO userDao;

    @Transactional
    @Override
    public List<IUser> findByName(String name) {
        return userDao.findByName(name);
    }

    @Transactional
    @Override
    public IUser findByUsernameAndPassword(String username, String password) {
        return userDao.findByUsernameAndPassword(username, password);
    }

    public IUserDAO getUserDao() {
        return userDao;
    }

    public void setUserDao(IUserDAO userDao) {
        this.userDao = userDao;
    }
}
